home *** CD-ROM | disk | FTP | other *** search
- Path: the-fly.zip.com.au!not-for-mail
- From: stuartm@zip.com.au (Stuart Mackinnon)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: *SLOW* colour cycling.. :(
- Date: 15 Feb 1996 00:48:24 GMT
- Organization: Very Little
- Message-ID: <4ftvso$u6q@the-fly.zip.com.au>
- References: <311c0fb8@beachyhd.demon.co.uk> <71270149@sunshine.stud.uni-frankfurt.de>
- NNTP-Posting-Host: zipper.zip.com.au
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Martin Steigerwald (steigerw@stud.uni-frankfurt.de) wrote:
- > Adam schrieb in comp.sys.amiga.programmer ueber "*SLOW* colour cycling..
- > :(":
- >
- > A>void cycle_colours(void) { int currcycle,i;
- > A>
- > A>CyclePos = (CyclePos + 20) % Colours;
- > A>
- > A>currcycle = CyclePos;
- > A>
- > A>for (i=0; i<Colours; i++) {
- > A>
- > A>SetRGB32(&(Screen1->ViewPort),i,Red[currcycle],Green[currcycle],Blue[currcycle]);
- > A>
- > A>currcycle = (currcycle+1) % Colours; } }
- >
- > Remove SetRGB32 from the loop and place
- > LoadRGB32 after it, do set the whole new palette with one system call :-)
- >
- > Calling SetRGB32 256 times in a loop couldnt be that fast.
-
- In fact the autodoc for LoadRGB32 says that it is faster than SetRGB32 even for 1
- colour, which means it is substantially faster for 256 colours. LoadRGB32 is the
- best function to use. I know, I wrote a screen colour cycler a year or so ago. Its
- even available on aminet - I could probably even give away the source if someone
- really wanted it (even though it was one of the first decent programs I did and
- I am disgusted at the code I wrote then - all those nasty globals).
-
- Regards,
-
- Stuart MacKinnon.
- --
-
- +- Stuart MacKinnon ------------------------------------ stuartm@zip.com.au -+
- | VIC20, CBM 128+1571, A1000+Sidecar, CD32, A4000/040+A4091+A2065+RetinaZ3! |
- | Registered BeBox Developer - for those at the bleeding edge. |
- | PHONE: +61 2 398 4578 (AH) +61 2 693 0445 (BH) |
- +--- Aztec C - Use it to MANXimise code inefficiency! -----------------------+
-